package com.icez.demo

import android.content.ClipData
import android.content.Intent
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.HapticFeedbackConstants
import android.view.View

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val phoneControlView = findViewById<PhoneControlView>(R.id.phoneControlView)

        phoneControlView.setPhoneControlAdapter(object: PhoneControlAdapter() {
            override fun setChildViewStyle(childView: CircleButton) {
                childView.setAttrs(1f, Color.WHITE,Color.YELLOW)
            }

        })

        val btn = findViewById<CircleButton>(R.id.btn)
        btn?.setOnLongClickListener {
            val intent = Intent()
            intent.putExtra(PhoneControlView.DRAG_PIC,R.mipmap.offered_play)
            intent.putExtra(PhoneControlView.DRAG_HEIGHT,it.measuredHeight)
            intent.putExtra(PhoneControlView.DRAG_WIDTH,it.measuredWidth)
            Util.instance.setDrag(intent,it)
            true
        }
    }
}